package com.xbongbong.saas.model.impl;


import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.saas.domain.dao.WorkReportCcDao;
import com.xbongbong.saas.domain.entity.WorkReportCcEntity;
import com.xbongbong.saas.model.WorkReportCcModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author long.rao
 * @version v1.0
 * @date 2019/2/1 15:08
 * @since v1.0
 */
@Service("workReportCcModel")
public class WorkReportCcModelImpl implements WorkReportCcModel {
    @Resource
    private WorkReportCcDao workReportCcDao;

    @Override
    public Integer insert(WorkReportCcEntity entity) throws XbbException {
        return workReportCcDao.insert(entity);
    }

    @Override
    public Integer update(WorkReportCcEntity entity) throws XbbException {
        return workReportCcDao.update(entity);
    }

    @Override
    public List<WorkReportCcEntity> findEntitys(Map<String, Object> param) {
        return workReportCcDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return workReportCcDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public WorkReportCcEntity getByKey(Long key, String corpid) {
        return workReportCcDao.getByKey(key, corpid);
    }

    @Override
    public Integer deleteByKey(Long key, String corpid) {
        return workReportCcDao.deleteByKey(key, corpid);
    }

    @Override
    public Integer deleteByReportId(Long reportId, String corpid) {
        return workReportCcDao.deleteByReportId(reportId, corpid);
    }

    @Override
    public Integer deleteBatch(List<Long> list, String corpid) {
        return workReportCcDao.deleteBatch(list, corpid);
    }

    @Override
    public Integer insertBatch(List<WorkReportCcEntity> list) throws XbbException{
        return workReportCcDao.insertBatch(list);
    }

    @Override
    public List<WorkReportCcEntity> getListByReportId(Long reportId, String corpid) {
        return workReportCcDao.getListByReportId(reportId,corpid);
    }

    /**
     * 批量更新工作报告抄送人中某公司某用户的姓名和头像
     */
    @Override
    public Integer dataConsistencyUpdateUser(String corpid, String userId,  String userName) {
        return workReportCcDao.dataConsistencyUpdateUser(corpid, userId, userName);
    }
}
